<?php
/**
 * Hesperos library for Zend Framework
 *
 * This script is protected by copyright. It's use, copying, modification
 * and distribution without written consent of the author is prohibited.
 *
 * @category    Hesperos
 * @package     Filter
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2011 Krzysztof Kardasz
 * @license     http://www.gnu.org/licenses/lgpl-3.0.txt  GNU Lesser General Public
 * @version     1.0 $Id$
 * @link        http://code.google.com/p/hesperos/
 */

/**
 * Filtr, opis skrócony
 *
 * @category    Hesperos
 * @package     Filter
 * @author      Krzysztof Kardasz <krzysztof.kardasz@gmail.com>
 * @copyright   Copyright (c) 2011 Krzysztof Kardasz
 * @version     1.0 $Id$
 */
class Hesperos_Filter_Description implements Zend_Filter_Interface
{
    /**
     * Skrócony opis, 200 znaków
     *
     * @param string $value
     * @return string
     */
    public function filter ($value)
    {
        $description = strip_tags($value);

        if (strlen($description) > 200) {
           $description = substr($description, 0, strrpos($description, ' ', 200)) . "&hellip;";
        }

        return $description;
    }
}